#include using namespace std; const int MATRIX_SIZE = 4; const int MATRIX_COUNT = 25; void getInititalMatrices(int matrices[][MATRIX_SIZE][MATRIX_SIZE], int& matricesUsed) { int initialMatrices; do { cout << "How many initial matrices?"; cin >> initialMatrices; } while(initialMatrices < 1 || initialMatrices > MATRIX_COUNT); while(matricesUsed < initialMatrices) { cout << "Enter matrix " << matricesUsed + 1 << endl; for(int row = 0; row < MATRIX_SIZE; row++) { cout << " Row " << row + 1 << "? "; for(int column = 0; column < MATRIX_SIZE; column++) { cin >> matrices[matricesUsed][row][column]; } } matricesUsed++; cout << endl; } } void getOperation(char& operation, int matricesUsed) { bool validOperation = false; do { cout << "Operation? "; cin >> operation; if( matricesUsed < MATRIX_COUNT) { if(operation == 'Q' || operation == 'q' || operation == 'T' || operation == 't' || operation == '+' || operation == '-' || operation == 'D' || operation == 'd' || operation == 'x' || operation == 'X' || operation == '*' ) { validOperation = true; } else { cout << "Invalid Operation...\n"; } } else { if(operation == 'Q' || operation == 'q' || operation == 'D' || operation == 'd') { validOperation = true; } else { cout << "Invalid Operation, there is not room for more results...\n"; } } } while(! validOperation); } void main() { int matrices[MATRIX_COUNT][MATRIX_SIZE][MATRIX_SIZE]; int matricesUsed = 0; char operation; getInititalMatrices(matrices, matricesUsed); getOperation(operation, matricesUsed); //do the operation //display the new matrix //go back and get the next operation }